#ifndef COMMEN_H
#define COMMEN_H

#include <QWidget>
#include<musiclist.h>
#include<QMediaPlaylist>
namespace Ui {
class Commen;
}
//区分不同页面
enum PageType
{
    LIKE_PAGE,//我喜欢页面
    LOCAL_PAGE,//本地下载页面
    HISTORY_PAGE//历史播放页面
};
class Commen : public QWidget
{
    Q_OBJECT

public:
    explicit Commen(QWidget *parent = nullptr);
    void setCommen(const QString& text,const QString& image);
    void setMusicListType(PageType pageType);
    void reFresh(MusicList& musicList);
    void setImageLabel(QPixmap pixMap);
    void addMusicToPlayer(MusicList& musicList,QMediaPlaylist* playlist);
    QString getMusicIdByIndex(int index);
    ~Commen();
signals:
    void updateLikeMusic(bool islike,QString musicID);
    void playMusicByIndex(Commen*,int);
    void playAll(PageType pagetype);
private:
    void addMusicToMusicPage(MusicList &musicList);
private:
    Ui::Commen *ui;
    QVector<QString> musicListOfPage;
    PageType pageType;
};

#endif // COMMEN_H
